package com.jk.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jk.dto.TemCandidate;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

/**
 * @Description 添加描述
 * @LastChangeDate 2025/2/17 14:15
 * @Version v1.0
 */
public interface TemCandidateMapper extends BaseMapper<TemCandidate> {

    IPage<TemCandidate> findTemCandidateList(@Param("candidate") TemCandidate temCandidate, Page<TemCandidate> page);

    TemCandidate getTemCandidateById(Integer id);



    @Update("update tem_candidate set process = '待面试' where id = #{id}")
     public void updateOneById(Integer id);
    @Update("update tem_candidate set process = '面试中' where id = #{id}")
    public void updateTwoById(Integer id);
    @Update("update tem_candidate set process = '面试通过' where id = #{id}")
    public void updateThreeById(Integer id);
    @Update("update tem_candidate set process = '已发offer' where id = #{id}")
    public void updateFourById(Integer id);
    @Update("update tem_candidate set process = '待入职' where id = #{id}")
    public void updateFiveById(Integer id);
    @Update("update tem_candidate set isdelete = 1 where id = #{id}")
    public void updateSixById(Integer id);

    List<TemCandidate> findEchartsProcessList(TemCandidate temCandidate);

    // 在招职位
    @Select("SELECT COUNT(job_title) FROM tem_position ")
    public Integer getRecruitingPositions();
    //计划招聘人数
    @Select("SELECT SUM(recruit_number) FROM tem_position")
    public Integer getPlannedRecruitmentNumber();
    //接收简历
    @Select("SELECT COUNT(id) FROM tem_candidate")
    public Integer getReceiveResumes();
    //面试中
    @Select("select count(id) from tem_candidate where process = '面试中'")
    public Integer getInterviewing();
//面试通过
    @Select("select count(id) from tem_candidate where process = '面试通过'")
    public Integer getMianshitongguo();
    //待入职
    @Select("select count(id) from tem_candidate where process = '待入职'")
    public Integer getDairuzhi();
    //已入职
    @Select("select count(id) from tem_candidate where isdelete = 1")
    public Integer getYiruzhi();

    public List<TemCandidate> findEchartsList();

    //各部门入职人数
    @Select("SELECT count(id) as value, employing_department as name FROM tem_candidate where isdelete = 1 GROUP BY  employing_department")
    List<Map<String, Object>> findShuJvList();
    //性别
    @Select("select count(id) as value , sex as name FROM tem_candidate GROUP BY sex")
    List<Map<String, Object>> findSexList();

    @Select("select count(id) as value, educational_background as name FROM tem_candidate GROUP BY educational_background")
    List<Map<String, Object>> findeducationalBackground();

    List<Map<String, Object>> getAgeList();

    List<Map<String, Object>> getRuzhiList();

    List<Map<String, Object>> getBaifenbiList();
}
